home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / gnome-1.0 / gtk-xmhtml / HTML.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-20  |  40.7 KB  |  1,103 lines

  1. /*****
  2. * HTML.h : XmHTML Widget public header file.
  3. *            Resource defines, enumerations and structures.
  4. *
  5. * This file Version    $Revision: 1.5 $
  6. *
  7. * Creation date:        Tue Apr 15 23:39:26 GMT+0100 1997
  8. * Last modification:     $Date: 1997/12/29 22:16:18 $
  9. * By:                    $Author: unammx $
  10. * Current State:        $State: Exp $
  11. *
  12. * Author:                newt
  13. *
  14. * Copyright (C) 1994-1997 by Ripley Software Development 
  15. * All Rights Reserved
  16. *
  17. * This file is part of the XmHTML Widget Library
  18. *
  19. * This library is free software; you can redistribute it and/or
  20. * modify it under the terms of the GNU Library General Public
  21. * License as published by the Free Software Foundation; either
  22. * version 2 of the License, or (at your option) any later version.
  23. *
  24. * This library is distributed in the hope that it will be useful,
  25. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  26. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  27. * Library General Public License for more details.
  28. *
  29. * You should have received a copy of the GNU Library General Public
  30. * License along with this library; if not, write to the Free
  31. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  32. *
  33. *****/
  34. /*****
  35. * $Source: /cvs/gnome/gnome-libs/gtk-xmhtml/Attic/HTML.h,v $
  36. *****/
  37. /*****
  38. * ChangeLog 
  39. * $Log: HTML.h,v $
  40. * Revision 1.5  1997/12/29 22:16:18  unammx
  41. * This version does:
  42. *
  43. *    - Sync with Koen to version Beta 1.1.2c of the XmHTML widget.
  44. *      Includes various table fixes.
  45. *
  46. *    - Callbacks are now properly checked for the Gtk edition (ie,
  47. *      signals).
  48. *
  49. * Revision 1.4  1997/12/26 23:54:37  unammx
  50. * More Gtk/XmHTML work: now a number of features can be configured on
  51. * the widget, look at the gazillions of options in gtk-xmhtml.h for
  52. * more information.  This is probably not complete, I have to read
  53. * over the XmHTML/Motif docs for figuring which other bits I am missing.
  54. *
  55. * Known bug: the parser is not fixing documents without <BODY> tags,
  56. * so this means that the program is crashing if you pass a document
  57. * withou the BODY.   I bet this is caused by some mistake of mine in
  58. * the handling of the old/new/current widgets as created by Motif.
  59. *
  60. * Miguel.
  61. *
  62. * Revision 1.3  1997/12/25 01:34:08  unammx
  63. * Good news for the day:
  64. *
  65. *    I have upgraded our XmHTML sources to XmHTML 1.1.1.
  66. *
  67. *    This basically means that we got table support :-)
  68. *
  69. * Still left to do:
  70. *
  71. *    - Set/Get gtk interface for all of the toys in the widget.
  72. *    - Frame support is broken, dunno why.
  73. *    - Form support (ie adding widgets to it)
  74. *
  75. * Miguel.
  76. *
  77. * Revision 1.2  1997/12/11 21:20:19  unammx
  78. * Step 2: more gtk/xmhtml code, still non-working - mig
  79. *
  80. * Revision 1.1  1997/11/28 03:38:53  gnomecvs
  81. * Work in progress port of XmHTML;  No, it does not compile, don't even try -mig
  82. *
  83. * Revision 1.6  1997/10/23 00:24:27  newt
  84. * XmHTML Beta 1.1.0 release
  85. *
  86. * Revision 1.5  1997/08/31 17:30:39  newt
  87. * Removed HT_TEXTFLOW
  88. *
  89. * Revision 1.4  1997/08/30 00:22:46  newt
  90. * Alpha channel resources: XmNalphaChannelProcessing and
  91. * XmNimageRGBConversion. Updated comments and reorganized a bunch of things.
  92. *
  93. * Revision 1.3  1997/08/01 12:52:11  newt
  94. * Progressive image loading changes
  95. *
  96. * Revision 1.2  1997/05/28 01:29:28  newt
  97. * XmImage changes: added the XmImageConfig structure and configuration flags.
  98. * Added support for the XmNdecodeGIFProc resource.
  99. *
  100. * Revision 1.1  1997/04/29 14:19:18  newt
  101. * Initial Revision
  102. *
  103. *****/ 
  104.  
  105. #ifndef _HTML_h_
  106. #define _HTML_h_
  107.  
  108. /* include our new resources */
  109. #ifdef WITH_MOTIF
  110. #    include <XmHTML/HTMLStrings.h>
  111. #endif
  112.  
  113. /******************************************************************************
  114. * Enumerations and other constants
  115. ******************************************************************************/
  116.  
  117. /*****
  118. * HTML Elements internal id's
  119. * This list is alphabetically sorted to speed up the searching process.
  120. * DO NOT MODIFY
  121. *****/
  122. typedef enum{
  123. HT_DOCTYPE, HT_A, HT_ADDRESS, HT_APPLET, HT_AREA, HT_B, HT_BASE, HT_BASEFONT,
  124. HT_BIG, HT_BLOCKQUOTE, HT_BODY, HT_BR, HT_CAPTION, HT_CENTER, HT_CITE, HT_CODE,
  125. HT_DD, HT_DFN, HT_DIR, HT_DIV, HT_DL, HT_DT, HT_EM, HT_FONT, HT_FORM, HT_FRAME,
  126. HT_FRAMESET, HT_H1, HT_H2, HT_H3, HT_H4, HT_H5, HT_H6, HT_HEAD, HT_HR, HT_HTML,
  127. HT_I, HT_IMG, HT_INPUT, HT_ISINDEX, HT_KBD, HT_LI, HT_LINK, HT_MAP, HT_MENU,
  128. HT_META, HT_NOFRAMES, HT_OL, HT_OPTION, HT_P, HT_PARAM, HT_PRE, HT_SAMP,
  129. HT_SCRIPT, HT_SELECT, HT_SMALL, HT_STRIKE, HT_STRONG, HT_STYLE, HT_SUB,
  130. HT_SUP, HT_TAB, HT_TABLE, HT_TD, HT_TEXTAREA, HT_TH, HT_TITLE,
  131. HT_TR, HT_TT, HT_U, HT_UL, HT_VAR, HT_ZTEXT
  132. }htmlEnum;
  133.  
  134. /*****
  135. * Corresponding HTML element name table. Indexing with the above enumeration
  136. * will give the corresponding element name.
  137. *****/
  138. extern String html_tokens[];
  139.  
  140. /***** 
  141. * XmHTML defines the following callback reasons. This might produce strange
  142. * results once Motif decides to uses enum values above 16383.
  143. * Send us a mail at ripley@xs4all.nl if you get problems that are due to
  144. * these enumeration values.
  145. *****/
  146. enum{
  147.     XmCR_HTML_ANCHORTRACK = 16384,        /* XmNanchorTrackCallback    */
  148.     XmCR_HTML_DOCUMENT,                    /* XmNdocumentCallback        */
  149.     XmCR_HTML_FORM,                        /* XmNformCallback            */
  150.     XmCR_HTML_FRAME,                    /* XmNframeCallback            */
  151.     XmCR_HTML_FRAMECREATE,                /* XmNframeCallback            */
  152.     XmCR_HTML_FRAMEDESTROY,                /* XmNframeCallback            */
  153.     XmCR_HTML_IMAGEMAPACTIVATE,            /* XmNimagemapCallback        */
  154.     XmCR_HTML_IMAGEMAP,                    /* XmNimagemapCallback        */
  155.     XmCR_HTML_LINK,                        /* XmNlinkCallback            */
  156.     XmCR_HTML_MODIFYING_TEXT_VALUE,        /* XmNmodifyVerifyCallback    */
  157.     XmCR_HTML_MOTIONTRACK,                /* XmNmotionTrackCallback    */
  158.     XmCR_HTML_PARSER,                    /* XmNparserCallback        */
  159.     XmCR_HTML_EVENT,                    /* XmNeventCallback            */
  160.     XmCR_HTML_EVENTDESTROY                /* XmNeventCallback            */
  161. };
  162.  
  163. /*****
  164. * XmNeventCallback sub event types
  165. *****/
  166. enum{
  167.     /* Document/Frame specific events */
  168.     XmCR_HTML_LOAD = 0,                /* onLoad        */
  169.     XmCR_HTML_UNLOAD,                /* onUnLoad        */
  170.  
  171.     /* HTML Form specific events */
  172.     XmCR_HTML_SUBMIT,                /* onSubmit        */
  173.     XmCR_HTML_RESET,                /* onReset        */
  174.     XmCR_HTML_FOCUS,                /* onFocus        */
  175.     XmCR_HTML_BLUR,                    /* onBlur        */
  176.     XmCR_HTML_SELECT,                /* onSelect        */
  177.     XmCR_HTML_CHANGE,                /* onChange        */
  178.  
  179.     /* object events */
  180.     XmCR_HTML_CLICK,                /* onClick        */
  181.     XmCR_HTML_DOUBLE_CLICK,            /* onDblClick    */
  182.     XmCR_HTML_MOUSEDOWN,            /* onMouseDown    */
  183.     XmCR_HTML_MOUSEUP,                /* onMouseUp    */
  184.     XmCR_HTML_MOUSEOVER,            /* onMouseOver    */
  185.     XmCR_HTML_MOUSEMOVE,            /* onMouseMove    */
  186.     XmCR_HTML_MOUSEOUT,             /* onMouseOut    */
  187.     XmCR_HTML_KEYPRESS,                /* onKeyPress    */
  188.     XmCR_HTML_KEYDOWN,                /* onKeyDown    */
  189.     XmCR_HTML_KEYUP,                /* onKeyUp        */
  190.     XmCR_HTML_USEREVENT                /* must always be last */
  191. };
  192.  
  193. /*****
  194. * URL types XmHTML knows of.
  195. * The hostnames, files and port numbers are only shown for demonstration
  196. * purposes, XmHTML doesn't care whether they are present or not.
  197. *****/
  198. typedef enum{
  199.     ANCHOR_UNKNOWN = 0,            /* unknown href                                */
  200.     ANCHOR_NAMED,                /* name="...."                                */
  201.     ANCHOR_JUMP,                /* href="#..."                                */
  202.     ANCHOR_FILE_LOCAL,            /* href="file.html"
  203.                                  * href="file:/file.html" (clearly local)
  204.                                  * href="file:///file.html" (NULL host)
  205.                                  * href="file://localhost/file.html" (localhost)
  206.                                  */
  207.     ANCHOR_FILE_REMOTE,            /* href="file://foo.bar/file.html"            */
  208.     ANCHOR_FTP,                    /* href="ftp://foo.bar/file"                */
  209.     ANCHOR_HTTP,                /* href="http://foo.bar/file.html"            */
  210.     ANCHOR_SECURE_HTTP,            /* href="https://foo.bar/file.html"            */
  211.     ANCHOR_GOPHER,                /* href="gopher://foo.bar:70"                */
  212.     ANCHOR_WAIS,                /* href="wais://foo.bar"                    */
  213.     ANCHOR_NEWS,                /* href="news://foo.bar"                    */
  214.     ANCHOR_TELNET,                /* href="telnet://foo.bar:23"                */
  215.     ANCHOR_MAILTO,                /* href="mailto:foo@bar"                    */
  216.     ANCHOR_EXEC,                /* href="exec:foo_bar"                        */
  217.     ANCHOR_PIPE,                /* href="pipe:foo_bar"                        */
  218.     ANCHOR_ABOUT,                /* href="about:..."                            */
  219.     ANCHOR_INFO,                /* href="info:.."                            */
  220.     ANCHOR_MAN,                    /* href="man:..."                            */
  221.     ANCHOR_FORM_IMAGE            /* <input type=image>, only used internally    */
  222. }URLType;
  223.  
  224. /*****
  225. * Procedure to be called whenever a script is encountered
  226. * Arguments:
  227. *    Tidget:        XmHTMLWidget id
  228. *    String:        script source text
  229. *    TPointer:    XmNclientData value
  230. * Return value:
  231. *    data to be stored whenever a document event should be processed.
  232. *    This data is unused internally and is provided as the user_data
  233. *    argument in the XmHTMLEvent structure. For example, the return value
  234. *    could be a pointer into some internal procedural database, a ptr to a
  235. *    compiled script procedure or the script source text if you want to
  236. *    process it at some later time (when the event occurs).
  237. *
  238. * When NULL is returned the event in question is disabled.
  239. *****/
  240. typedef TPointer (*XmHTMLEventProc)(TWidget, String, TPointer);
  241.  
  242. /*****
  243. * HTML Form component types
  244. *****/
  245. typedef enum{
  246.     FORM_TEXT = 1,                    /* textfield                        */
  247.     FORM_PASSWD,                    /* password textfield                */
  248.     FORM_CHECK,                        /* checkbox                            */
  249.     FORM_RADIO,                        /* radiobox                            */
  250.     FORM_RESET,                        /* reset button                        */
  251.     FORM_FILE,                        /* filelisting                        */
  252.     FORM_SELECT,                    /* select parent                    */
  253.     FORM_OPTION,                    /* select child                        */
  254.     FORM_TEXTAREA,                    /* multiline edit field                */
  255.     FORM_IMAGE,                        /* drawbutton                        */
  256.     FORM_HIDDEN,                    /* hidden input                        */
  257.     FORM_SUBMIT                        /* submit button                    */
  258. }componentType;
  259.  
  260. /*****
  261. * Supported HTML Form method types
  262. *****/
  263. enum{
  264.     XmHTML_FORM_GET = 0,            /* method = get                        */
  265.     XmHTML_FORM_POST,                /* method = post                    */
  266.     XmHTML_FORM_PIPE                /* method = pipe                    */
  267. };
  268.  
  269. /*****
  270. * possible error codes for XmNparserCallback
  271. *****/
  272. typedef enum{
  273.     HTML_UNKNOWN_ELEMENT = 1,    /* unknown HTML element                        */
  274.     HTML_BAD,                    /* very badly placed element                */
  275.     HTML_OPEN_BLOCK,            /* block still open while new block started    */
  276.     HTML_CLOSE_BLOCK,            /* block closed but was never opened        */
  277.     HTML_OPEN_ELEMENT,            /* unbalanced terminator                    */
  278.     HTML_NESTED,                /* improperly nested element                */
  279.     HTML_VIOLATION,                /* bad content for current block/element    */
  280.     HTML_NOTIFY,                /* notification of text insertion/removal    */
  281.     HTML_INTERNAL                /* internal parser error                    */
  282. }parserError;
  283.  
  284. /*****
  285. * And corresponding values for XmNenableBadHTMLWarnings.
  286. * These are or'd together.
  287. * XmNONE disables warnings and XmHTML_ALL enables all warnings.
  288. * See parserError for their meaning.
  289. *****/
  290. enum{
  291.     XmHTML_NONE = 0,                /* no warnings    */
  292.     XmHTML_UNKNOWN_ELEMENT = 1,    
  293.     XmHTML_BAD = 2,
  294.     XmHTML_OPEN_BLOCK = 4,
  295.     XmHTML_CLOSE_BLOCK = 8,
  296.     XmHTML_OPEN_ELEMENT = 16,
  297.     XmHTML_NESTED = 32,
  298.     XmHTML_VIOLATION = 64,
  299.     XmHTML_ALL = 127            /* all warnings    */
  300. };
  301.  
  302. /*****
  303. * possible action codes for the action field in the XmHTMLParserCallbackStruct
  304. *****/
  305. enum{
  306.     HTML_REMOVE = 1,            /* remove offending element                    */
  307.     HTML_INSERT,                /* insert missing element                    */
  308.     HTML_SWITCH,                /* switch offending and expected element    */
  309.     HTML_KEEP,                    /* keep offending element                    */
  310.     HTML_IGNORE,                /* ignore, proceed as if nothing happened    */
  311.     HTML_ALIAS,                    /* alias an unknown element to known one    */
  312.     HTML_TERMINATE                /* terminate parser                            */
  313. };
  314.  
  315. /*****
  316. * Possible return codes for XmHTMLImageGetType().
  317. *****/
  318. enum{
  319.     IMAGE_ERROR = 0,            /* error on image loading            */
  320.     IMAGE_UNKNOWN,                /* unknown image                    */
  321.     IMAGE_XPM,                    /* X11 pixmap                        */
  322.     IMAGE_XBM,                    /* X11 bitmap                        */
  323.     IMAGE_GIF,                    /* CompuServe(C) Gif87a or Gif89a    */
  324.     IMAGE_GIFANIM,                /* animated gif                        */
  325.     IMAGE_GIFANIMLOOP,            /* animated gif with loop extension    */
  326.     IMAGE_GZF,                    /* compatible Gif87a or Gif89a        */
  327.     IMAGE_GZFANIM,                /* compatible animated gif            */
  328.     IMAGE_GZFANIMLOOP,            /* compatible animated gif             */
  329.     IMAGE_JPEG,                    /* JPEG image                        */
  330.     IMAGE_PNG,                    /* PNG image                        */
  331.     IMAGE_FLG                    /* Fast Loadable Graphic            */
  332. };
  333.  
  334. /*****
  335. * Possible return values for a function installed on the
  336. * XmNprogressiveReadProc resource.
  337. *****/
  338. #define STREAM_OK         1        /* internally used value                    */
  339. #define STREAM_END         0        /* data stream ended (no more data)            */
  340. #define STREAM_SUSPEND    -1        /* data stream suspended (not enough data)    */
  341. #define STREAM_ABORT    -2        /* data stream aborted                        */
  342. #define STREAM_RESIZE    -3        /* resize input buffer                        */
  343.  
  344. /*****
  345. * Possible return values for the XmNdecodeGIFProc resource and 
  346. * values for the XmHTMLGIFStream state.
  347. *****/
  348. #define GIF_STREAM_OK         2
  349. #define GIF_STREAM_END         1
  350. #define GIF_STREAM_ERR         0
  351. #define GIF_STREAM_INIT        -1
  352. #define GIF_STREAM_FINAL    -2
  353.  
  354. /*****
  355. * Possible return values from a number of image related routines.
  356. * The actual meaning depends on the routine used.
  357. *****/
  358. typedef enum{
  359.     XmIMAGE_ERROR = 0,        /* unknown error occured */
  360.     XmIMAGE_BAD,            /* bad function call: missing arg or so */
  361.     XmIMAGE_UNKNOWN,        /* provided XmImage/XmImageInfo unknown/unbound */
  362.     XmIMAGE_ALMOST,            /* action completed, further response necessary */
  363.     XmIMAGE_OK                /* action completed. */
  364. }XmImageStatus;
  365.  
  366. /*****
  367. * Possible values for transparency (value for the "bg" field in both
  368. * XmImage and XmImageInfo structures). Possible values are:
  369. *
  370. * XmIMAGE_NONE
  371. *    indicates the image is not transparent
  372. * XmIMAGE_TRANSPARENCY_BG
  373. *    indicates the image achieves transparency by substituting the current
  374. *    background setting (can be a single color or background image. Internally,
  375. *    such transparency is achieved by using a clipmask).
  376. * XmIMAGE_TRANSPARENCY_ALPHA
  377. *    indicates the image achieves transparency by using an alpha channel.
  378. *    This transparency is currently only used by PNG images with an alpha
  379. *    channel or a tRNS chunk (which is expanded to an alpha channel internally).
  380. *****/
  381. enum{
  382.     XmIMAGE_NONE = 0,
  383.     XmIMAGE_TRANSPARENCY_BG,
  384.     XmIMAGE_TRANSPARENCY_ALPHA
  385. };
  386.  
  387. /*****
  388. * Possible values for the colorspace value.
  389. *
  390. * XmIMAGE_COLORSPACE_GRAYSCALE
  391. *    image contains only shades of gray. The colorcube is reduced to a 1D
  392. *    representation. All components in a shade have the same value. The
  393. *    pixel values are equal to the value of a single color component.
  394. * XmIMAGE_COLORSPACE_INDEXED
  395. *    image uses a fixed palette. Colorcube is mapped to a 1D lookup-table.
  396. * XmIMAGE_COLORSPACE_RGB
  397. *    image uses a full 3D colorcube. 
  398. *****/
  399. enum{
  400.     /* XmIMAGE_NONE */
  401.     XmIMAGE_COLORSPACE_GRAYSCALE = 1,
  402.     XmIMAGE_COLORSPACE_INDEXED,
  403.     XmIMAGE_COLORSPACE_RGB
  404. };
  405.  
  406. /*****
  407. * XmImageInfo structure options field bits.
  408. * The ``Set by default'' indicates a bit set when the XmHTMLImageDefaultProc
  409. * is used to read an image. The ``Read Only'' indicates a bit you should
  410. * consider as read-only.
  411. * XmIMAGE_DELAYED
  412. *    Indicates the image is delayed, e.i. it will be provided at a later stage;
  413. * XmIMAGE_DEFERRED_FREE
  414. *    Indicates XmHTML may free this structure when a new document is loaded.
  415. * XmIMAGE_IMMEDIATE_FREE
  416. *    Indicates XmHTML may free this structure when XmHTML no longer needs it;
  417. * XmIMAGE_RGB_SINGLE
  418. *    Indicates that the reds, greens and blues fields are allocated in a single
  419. *    memory area instead of three seperate memory arrays.
  420. * XmIMAGE_ALLOW_SCALE
  421. *    Indicates that scaling an image is allowed.
  422. * XmIMAGE_FRAME_IGNORE
  423. *    Use with animations: set this bit when a frame falls outside the logical
  424. *    screen area. No pixmap is created but the timeout for the frame is kept.
  425. * XmIMAGE_CLIPMASK
  426. *    This bit is set when the returned XmImageInfo structure contains clipmask
  427. *    data. XmHTML uses this info to create a clipping bitmap. Changing this
  428. *    bit from set to unset will lead to a memory leak while changing it from
  429. *    unset to set *without* providing a clipmask yourself *will* cause an error
  430. *    to happen. You can set this bit when you are providing your own clipmask
  431. *    (to provide non-rectangular images for example), PROVIDED you fill the
  432. *    ``clip'' field with valid bitmap data (a stream of bytes in XYBitmap format
  433. *    and the same size of the image).
  434. * XmIMAGE_SHARED_DATA
  435. *    This bit is set when images share data. XmHTML sets this bit when the image
  436. *    in question is an internal image, e.i., one for which the image data may
  437. *    never be freed. Be carefull setting this bit yourself, since it prevents
  438. *    XmHTML from freeing the image data present in the XmImageInfo structure.
  439. *    It can easily lead to memory leaks when an image is *not* an internal
  440. *    image.
  441. * XmIMAGE_PROGRESSIVE
  442. *    Setting this bit will enable XmHTML progressive image loading. A function
  443. *    *must* have been installed on the XmNprogressiveReadProc resource *prior*
  444. *    to setting this bit. Installing a function on the XmNprogressiveEndProc
  445. *    is optional. When this bit is set all other bits will be ignored.
  446. * XmIMAGE_DELAYED_CREATION
  447. *    This bit is read-only. It is used internally by XmHTML for images with
  448. *    an alpha channel. Alpha channel processing merges the current background
  449. *    with the original RGB data from the image and uses the result to compose
  450. *    the actual on-screen image (the merged data is stored in the ``data''
  451. *    field of the XmImageInfo structure). XmHTML needs to store the original
  452. *    data somewhere, and when this bit is set it is stored in the ``rgb'' field
  453. *    of the XmImageInfo structure.
  454. *    When this bit is set, the returned XmImageInfo may *NOT BE FREED* as long
  455. *    as the current document is alive. You can discard it as soon as a new
  456. *    document is loaded.
  457. *****/
  458. #define XmIMAGE_DELAYED            (1<<1)
  459. #define XmIMAGE_DEFERRED_FREE    (1<<2)        /* set by default */
  460. #define XmIMAGE_IMMEDIATE_FREE    (1<<3)
  461. #define XmIMAGE_RGB_SINGLE        (1<<4)        /* set by default */
  462. #define XmIMAGE_ALLOW_SCALE        (1<<5)        /* set by default */
  463. #define XmIMAGE_FRAME_IGNORE    (1<<6)
  464. #define XmIMAGE_CLIPMASK        (1<<7)        /* Read Only */
  465. #define XmIMAGE_SHARED_DATA        (1<<8)        /* Read Only */
  466. #define XmIMAGE_PROGRESSIVE        (1<<9)
  467.  
  468. #define XmIMAGE_DELAYED_CREATION (1<<10)    /* Read Only */
  469.  
  470. /*****
  471. * XmImageInfo animation disposal values
  472. * A disposal method specifies what should be done before the current frame is
  473. * rendered. Possible values are:
  474. * XmIMAGE_DISPOSE_NONE
  475. *    do nothing, overlays the previous frame with the current frame.
  476. * XmIMAGE_DISPOSE_BY_BACKGROUND
  477. *    Restore to background color. The area used by the previous frame must
  478. *    be restored to the background color/image
  479. * XmIMAGE_DISPOSE_BY_PREVIOUS
  480. *    Restore to previous. The area used by the previous frame must be
  481. *    restored to what was there prior to rendering the previous frame.
  482. *****/
  483. enum{
  484.     /* XmIMAGE_NONE */
  485.     XmIMAGE_DISPOSE_NONE = 1,        /* default behaviour */
  486.     XmIMAGE_DISPOSE_BY_BACKGROUND,
  487.     XmIMAGE_DISPOSE_BY_PREVIOUS
  488. };
  489.  
  490. /*****
  491. * Primary image cache actions
  492. * (unimplemented)
  493. *****/
  494. #define IMAGE_STORE        0            /* store an image in the cache */
  495. #define IMAGE_GET        1            /* retrieve an image from the cache */
  496. #define IMAGE_DISCARD    2            /* discard an image from the cache */
  497.  
  498. /*****
  499. * XmNperfectColors/XmNalphaChannelProcessing resource values.
  500. *
  501. * Note: these values are represented by the XmCEnableMode resource class.
  502. *****/
  503. enum{
  504.     /* XmAUTOMATIC */
  505.     XmALWAYS = 1,
  506.     XmNEVER
  507. };
  508.  
  509. /*****
  510. * Possible XmNimageMapToPalette/XmNimageRGBConversion resource values:
  511. *
  512. * XmQUICK
  513. *    RGBConversion:
  514. *        first checks if the 24bit image contains less than XmNmaxImageColors.
  515. *        If not, XmHTML will dither to a fixed palette. This is fast but has
  516. *        the disadvantage that the background color in an alpha channelled
  517. *        image will not be matched exactly.
  518. *    MapToPalette:
  519. *        Use closest distance algorithm to map colors to the palette. No
  520. *        error correction is performed. Reasonably fast, but quality 
  521. *        heavily depends on the distribution of the colors in the image.
  522. * XmBEST
  523. *    RGBConversion (default):
  524. *        first checks if the 24bit image contains less than XmNmaxImageColors.
  525. *        If it is, the actual image colors are used. If not, a histogram of the
  526. *        image is computed, the most used colors are selected and the resulting
  527. *        image is dithered to this palette.
  528. *        Offers best 24 to 8bit conversion and is probably faster than XmSLOW
  529. *        as only images with more than XmNmaxImageColors will be dithered. 
  530. *    MapToPalette:
  531. *        Ordered dithering using predefined error matrices. Reasonably fast and
  532. *        quite good results;
  533. * XmFAST
  534. *    RGBConversion:
  535. *        Skips the check and dithers to a fixed palette right away. This is the
  536. *        fastest way to do 24 to 8bit conversion but has the disadvantage that
  537. *        every 24bit image is dithered to a fixed palette, regardless of the
  538. *        actual no of colors in the image.
  539. *    MapToPalette:
  540. *        Simple ordered dithering. Fastest but probably the poorest results.
  541. * XmSLOW
  542. *    RGBConversion:
  543. *        Skips the check and does histogram stuff right away.
  544. *    MapToPalette:
  545. *        closest distance algorithm to map image colors to the palette and use
  546. *        dynamic error correction. Slowest but best results;
  547. * XmDISABLED
  548. *    RGBConversion:
  549. *        ignored;
  550. *    MapToPalette (default):
  551. *        Disables palette mapping;
  552. *
  553. * Note: these values are represented by the XmCConversionMode resource class.
  554. *****/
  555. typedef enum {
  556.     XmQUICK = 0,
  557.     XmBEST,
  558.     XmFAST,
  559.     XmSLOW,
  560.     XmDISABLED
  561. } XmHTMLDitherType;
  562.  
  563. /*****
  564. * Search directions: forward or backward search
  565. *****/
  566. typedef enum{
  567.     XmHTML_FORWARD,
  568.     XmHTML_BACKWARD
  569. }XmHTMLDirection;
  570.  
  571. /*****
  572. * XmHTMLPosition is a fully opaque type
  573. *****/
  574. typedef struct _XmHTMLObjectTableElement *XmHTMLPosition;
  575.  
  576. /*****
  577. * Custom Papersize dimension unit type
  578. * (under construction)
  579. *****/
  580. enum{
  581.     XmHTML_CHAR = 0,
  582.     XmHTML_CENTIMETER,            /* 1cm = 0.39in                    */
  583.     XmHTML_MILLIMETER,            /* 1mm = 0.1cm                    */
  584.     XmHTML_INCH,                /* 1in = 2.54cm                    */
  585.     XmHTML_PICA,                /* 1pc = 12pt                    */
  586.     XmHTML_POINT                /* 1in = 72.27pt, 1cm = 28.45pt    */
  587. };
  588.  
  589. /*****
  590. * XmHTMLTextGetFormatted paper size defines
  591. * (under construction)
  592. *****/
  593. enum{
  594.     XmHTMLTEXT_PAPERSIZE_A4 = 0,
  595.     XmHTMLTEXT_PAPERSIZE_LETTER,
  596.     XmHTMLTEXT_PAPERSIZE_CUSTOM
  597. };
  598.  
  599. /*****
  600. * XmHTMLTextGetFormatted type definitions
  601. * (under construction)
  602. *****/
  603. enum{
  604.     XmHTMLTEXT_PLAIN = 0,        /* generate plain ASCII document        */
  605.     XmHTMLTEXT_FORMATTED,        /* generate formatted ASCII document    */
  606.     XmHTMLTEXT_POSTSCRIPT         /* generate formatted Postscript output    */
  607. };
  608.  
  609. /*****
  610. * XmHTMLTextGetFormatted Postscript option bits
  611. * (under construction)
  612. * The MIMIC_FONTS bit instructs XmHTML to use any of the supported postscript
  613. * fonts to approach the fonts used in the document. When set, all other font
  614. * bits are ignored. When not used, the PSFONT bits can be or'd together.
  615. * XmHTML will attempt to do the following mapping:
  616. *    PSFONT_ROMAN/PSFONT_CENTURY -> default text font;
  617. *    PSFONT_HELVETICA/PSFONT_LUCIDA -> fixed width font;
  618. * If only one of the PSFONT bits is set, the entire document will be rendered
  619. * in that font.
  620. *****/
  621. #define XmHTMLTEXT_ADDHEADER                (1<<1)
  622. #define XmHTMLTEXT_ADDFOOTER                (1<<2)
  623. #define XmHTMLTEXT_PSFONT_ROMAN                (1<<3)
  624. #define XmHTMLTEXT_PSFONT_HELVETICA            (1<<4)
  625. #define XmHTMLTEXT_PSFONT_CENTURY            (1<<5)
  626. #define XmHTMLTEXT_PSFONT_LUCIDA            (1<<6)
  627. #define XmHTMLTEXT_MIMIC_FONTS                (1<<7)
  628.  
  629. /*****
  630. * XmHTMLGetHeadAttributes mask bits
  631. *****/
  632. #define HeadClear        ((unsigned char)0)    /* clear everything        */
  633. #define HeadDocType        (1<<0)                /* fill doctype member    */
  634. #define HeadTitle        (1<<1)                /* fill title member    */
  635. #define HeadIsIndex        (1<<2)                /* fill isIndex member    */
  636. #define HeadBase        (1<<3)                /* fill Base member        */
  637. #define HeadMeta        (1<<4)                /* fill meta members    */
  638. #define HeadLink        (1<<5)                /* fill link members    */
  639. #define HeadScript        (1<<6)                /* fill script members    */
  640. #define HeadStyle        (1<<7)                /* fill Style members    */
  641. #define HeadAll            ((unsigned char)~0)    /* fill all members        */
  642.  
  643. /*****
  644. * XmImage frame selection flags.
  645. * any positive number will return the requested frame. If larger than
  646. * total framecount, last frame is returned.
  647. *****/
  648. #define AllFrames        -1             /* do all frames                */
  649. #define FirstFrame        -2            /* only use first frame            */
  650. #define LastFrame        -3            /* only do last frame            */
  651.  
  652. /*****
  653. * XmImage configuration flags
  654. *****/
  655. #define ImageFSDither        (1L<<1)    /* Floyd-Steinberg on quantized images    */
  656. #define ImageCreateGC        (1L<<2)    /* create gc for image                    */
  657. #define ImageWorkSpace        (1L<<3)    /* create animation workspace            */
  658. #define ImageClipmask        (1L<<4)    /* create clipmask                        */
  659. #define ImageBackground        (1L<<5)    /* substitute background pixel            */
  660. #define ImageQuantize        (1L<<6)    /* quantize image                        */
  661. #define ImageMaxColors        (1L<<7)    /* sets maximum colors                    */
  662. #define ImageGifDecodeProc    (1L<<8)    /* gif lzw decoder function                */
  663. #define ImageGifzCmd        (1L<<9)    /* gif lzw uncompress command            */
  664. #define ImageFrameSelect    (1L<<10)/* frame selection                        */
  665. #define ImageScreenGamma    (1L<<11)/* gamma correction. JPEG and PNG only    */
  666.  
  667. /******************************************************************************
  668. * Commonly used structures
  669. ******************************************************************************/
  670.  
  671. /*****
  672. * Representation of parsed HTML elements
  673. *****/
  674. typedef struct _XmHTMLObject{
  675.     htmlEnum id;                /* internal ID for this element                */
  676.     String element;                /* element text                                */
  677.     String attributes;            /* element attributes (if any)                */
  678.     Boolean is_end;                /* true if this is a closing element        */
  679.     Boolean terminated;            /* true if element has closing counterpart    */
  680.     Cardinal line;                /* line number in input for this element    */
  681.     struct _XmHTMLObject *next;
  682.     struct _XmHTMLObject *prev;
  683. }XmHTMLObject;
  684.  
  685. /*****
  686. * Custom papersize definition
  687. *****/
  688. typedef struct _XmHTMLPaperSize{
  689.     unsigned char unit_type;    /* unit in which dimensions are specified    */
  690.     unsigned char paper_type;    /* type of paper: A4, US or custom            */
  691.     Cardinal width;                /* total paper width                        */
  692.     Cardinal height;            /* total paper height                        */
  693.     Cardinal left_margin;        /* left text margin                            */
  694.     Cardinal right_margin;        /* right text margin                        */
  695.     Cardinal top_margin;        /* top text margin                            */
  696.     Cardinal bottom_margin;        /* bottom text margin                        */
  697. }XmHTMLPaperSize;
  698.  
  699. /***** 
  700. * The following structure is returned by the XmHTMLImageDefaultProc convenience
  701. * function. When a procedure for the XmNimageProc resource is installed,
  702. * it *must* return this structure.
  703. *****/
  704. typedef struct _XmImageInfo
  705. {
  706.     /* regular image fields */
  707.     String url;                    /* original location of image                */
  708.     unsigned char *data;        /* raw image data. ZPixmap format            */
  709.     unsigned char *clip;        /* raw clipmask data. XYBitmap format        */
  710.     Dimension width;            /* used image width, in pixels                */
  711.     Dimension height;            /* used image height, in pixels                */
  712.     Dimension *reds;            /* red image pixels                            */
  713.     Dimension *greens;            /* green image pixels                        */
  714.     Dimension *blues;            /* blue image pixels                        */
  715.     int bg;                        /* transparent pixel index/type                */
  716.     unsigned int ncolors;        /* Number of colors in the image            */
  717.     unsigned int options;        /* image option bits                        */
  718.  
  719.     /* image classification fields and original data */
  720.     unsigned char type;            /* image type, see the IMAGE_ enum above    */
  721.     unsigned char depth;        /* bits per pixel for this image            */
  722.     unsigned char colorspace;    /* colorspace for this image                */
  723.     unsigned char transparency;    /* transparency type for this image            */
  724.     Dimension swidth;            /* image width as read from image            */
  725.     Dimension sheight;            /* image height as read from image            */
  726.     unsigned int scolors;        /* Original number of colors in the image    */
  727.  
  728.     /* Special fields for images with an alpha channel */
  729.     unsigned char *alpha;        /* alpha channel data                         */
  730.     float fg_gamma;                /* image gamma                                */
  731.  
  732.     /* Additional animation data */
  733.     int x;                        /* logical screen x-position for this frame    */
  734.     int y;                        /* logical screen y-position for this frame    */
  735.     int loop_count;                /* animation loop count                        */
  736.     unsigned char dispose;        /* image disposal method                    */
  737.     int timeout;                /* frame refreshment in milliseconds        */
  738.     int nframes;                /* no of animation frames remaining            */
  739.     struct _XmImageInfo *frame;    /* ptr to next animation frame                */
  740.  
  741.     TPointer user_data;        /* any data to be stored with this image    */
  742. }XmImageInfo, *XmImageInfoStruct;
  743.  
  744. /* XmHTML method to load images */
  745. typedef XmImageInfo* (*XmImageProc)(TWidget, String, TPointer);
  746.  
  747. /****
  748. * The next two structures constitute the XmImage definition which are used by
  749. * the XmImageCreate and XmImageDestroy routines. Please note that the *only*
  750. * safe way to destroy an XmImage is to use the XmImageDestroy function.
  751. * XmHTML does not use the XmImage structure, it is provided for your
  752. * convenience.
  753. ****/
  754. /****
  755. * Animation frame data.
  756. ****/
  757. typedef struct{
  758.     int x;                    /* x position in logical screen        */
  759.     int y;                    /* y position in logical screen        */
  760.     int w;                    /* width of this particular frame    */
  761.     int h;                    /* height of this particular frame    */
  762.     int timeout;            /* timeout for the next frame        */
  763.     unsigned char dispose;    /* previous frame disposal method    */
  764.     TPixmap pixmap;            /* actual image                        */
  765.     TPixmap clip;            /* image clipmask                    */
  766.     TPixmap prev_state;        /* previous screen state            */
  767. }XmImageFrame;
  768.  
  769. /*****
  770. * Actual image definition.
  771. * If you want access to the xcc member, include the XCC.h header file.
  772. *****/
  773. typedef struct{
  774.     String file;                /* originating file                            */
  775.     unsigned char type;            /* image type, see the IMAGE_ enum below    */
  776.     TPixmap pixmap;                /* actual image                                */
  777.     TPixmap clip;                /* for transparant pixmaps                    */
  778.     unsigned int options;        /* image option bits                        */
  779.     int width;                    /* current image width, in pixels            */
  780.     int height;                    /* current image height, in pixels            */
  781.     int ncolors;                /* no of colors in this image                */
  782.     int scolors;                /* specified no of colors                     */
  783.     int swidth;                    /* image width as read from image            */
  784.     int sheight;                /* image height as read from image            */
  785.     int depth;                    /* depth of this image                        */
  786.     int npixels;                /* no of really allocated pixels            */
  787.     TGC gc;                        /* graphics context for rendering            */
  788.  
  789.     /* animation data */
  790.     XmImageFrame *frames;        /* array of animation frames                */
  791.     int nframes;                /* no of frames following                    */
  792.     int current_frame;            /* current frame count                        */
  793.     int current_loop;            /* current loop count                        */
  794.     int loop_count;                /* maximum loop count                        */
  795.     TIntervalId proc_id;        /* timer id for animations                    */
  796.     TWidget w;                    /* image owner                                */
  797.     TAppContext context;        /* Application context for animations        */
  798.  
  799.     /* private data */
  800.       struct _XColorContext *xcc;    /* a lot of visual info                        */
  801. }XmImage;
  802.  
  803. /*****
  804. * Link member information.
  805. *****/
  806. typedef struct
  807. {
  808.     String url;                /* value of URL tag        */
  809.     String rel;                /* value of REL tag        */
  810.     String rev;                /* value of REV tag        */
  811.     String title;            /* value of TITLE tag    */
  812. }XmHTMLLinkDataRec, *XmHTMLLinkDataPtr;
  813.  
  814. /*****
  815. * Meta member information.
  816. *****/
  817. typedef struct
  818. {
  819.     String http_equiv;        /* value of HTTP-EQUIV tag    */
  820.     String name;            /* value of NAME tag        */
  821.     String content;            /* value of CONTENT tag        */
  822. }XmHTMLMetaDataRec, *XmHTMLMetaDataPtr;
  823.  
  824. /*****
  825. * XmHTMLHeadAttributes definition
  826. *****/
  827. typedef struct{
  828.     String doctype;                /* doctype data                                */
  829.     String title;                /* document title                            */
  830.     Boolean is_index;            /* true when the <isindex> element exists    */
  831.     String base;                /* value of the <base> element                */
  832.     int num_meta;                /* number of META info to process            */
  833.     XmHTMLMetaDataPtr meta;        /* array of META info to process            */
  834.     int num_link;                /* number of LINK info to process            */
  835.     XmHTMLLinkDataPtr link;        /* array of LINK info to process            */
  836.     String style_type;            /* value of the style type element tag        */
  837.     String style;                /* <style></style> contents                    */
  838.     String script_lang;            /* value of the language element tag        */
  839.     String script;                /* <script></script> contents                */
  840. }XmHTMLHeadAttributes;
  841.  
  842. /*****
  843. * XmHTMLFontCacheInfo definition. This structure is returned by the
  844. * XmHTMLGetFontCacheInfo convenience routine and contains information about
  845. * the font cache bound to the display of a given widget.
  846. * The fonts and mapping arrays are in sync: when a name in the fonts array
  847. * has a non-NULL entry at the corresponding position in the mapping array,
  848. * the value of the mapping entry is the real font being used.
  849. *****/
  850. typedef struct{
  851.     int nentries;                    /* total no of cached fonts */
  852.     int nmaps;                        /* of which this many are mapped fonts */
  853.     int nlookups;                    /* no of search actions */
  854.     int nrequests;                    /* no of requests made */
  855.     int hits;                        /* no of hits */
  856.     int misses;                        /* no of misses */
  857.     String *fonts;                    /* array of font names, size nentries */
  858.     String *mapping;                /* array of font mappings, size nentries */
  859.     int nwidgets;                    /* no of widgets using this cache */
  860.     WidgetList widgets;                /* array of widgets */
  861. }XmHTMLFontCacheInfo;
  862.  
  863. /*****
  864. * forward declaration of XmHTMLAnchorCallback structure
  865. *****/
  866. typedef struct _XmHTMLAnchorCallbackStruct *XmHTMLAnchorPtr;
  867.  
  868. /*****
  869. * XmHTMLXYToInfo return value
  870. * This structure and any of it members may *never* be freed by the caller.
  871. *****/
  872. typedef struct
  873. {
  874.     Cardinal line;                /* line number at selected position            */
  875.     Boolean is_map;                /* true when clicked image is an imagemap    */
  876.     int x,y;                    /* position relative to image corner        */
  877.     XmImageInfo *image;            /* image data                                */
  878.     XmHTMLAnchorPtr anchor;        /* possible anchor data                        */
  879. }XmHTMLInfoStructure, *XmHTMLInfoPtr;
  880.  
  881. /*****
  882. * XmHTML progressive object loading
  883. * (PLC stands for Progressive Loader Context)
  884. *****/
  885. typedef struct _XmHTMLPLCStream{
  886.     Cardinal total_in;            /* no of bytes received so far                */
  887.     Cardinal min_out;            /* minimum number of bytes requested        */
  888.     Cardinal max_out;            /* maximum number of bytes requested        */
  889.     TPointer user_data;        /* any data registered on this PLC            */
  890.     unsigned char pad[24];        /* reserved for future use                    */
  891. }XmHTMLPLCStream;
  892.  
  893. /*****
  894. * External GIF decoder stream object. This is the only argument to any
  895. * procedure installed on the XmNdecodeGIFProc resource.
  896. *
  897. * The first block is kept up to date by XmHTML and is read-only. When state
  898. * is GIF_STREAM_INIT, the decoder should initialize it's private data and store
  899. * it in the external_state field so that it can be used for successive calls
  900. * to the decoder. When state is GIF_STREAM_FINAL, the decoder should wrapup
  901. * and flush all pending data. It can also choose to destruct it's internal
  902. * data structures here (another call with state set to GIF_STREAM_END will be
  903. * made when the internal loader is destroying it's internal objects as
  904. * well).
  905. *
  906. * All following fields are the ``public'' fields and must be updated by the 
  907. * external decoder. The msg field can be set to an error message if the
  908. * external decoder fails for some reason. XmHTML will then display this 
  909. * error message and abort this image.
  910. *****/
  911. typedef struct _XmHTMLGIFStream{
  912.     /* read-only fields */
  913.     int state;                    /* decoder state                        */
  914.     int codesize;                /* initial LZW codesize                    */
  915.     Boolean is_progressive;        /* when used by a progressive loader    */
  916.     unsigned char *next_in;        /* next input byte                        */
  917.     Cardinal avail_in;            /* number of bytes available at next_in    */
  918.     Cardinal total_in;            /* total nb of input bytes read so far    */
  919.  
  920.     /* fields to be updated by caller */
  921.     unsigned char *next_out;    /* next output byte should be put there    */
  922.     Cardinal avail_out;            /* remaining free space at next_out        */
  923.     Cardinal total_out;            /* total nb of bytes output so far        */
  924.  
  925.     String msg;                    /* last error message, or NULL            */
  926.     TPointer external_state;    /* room for decoder-specific data        */
  927. }XmHTMLGIFStream;
  928.  
  929. /* and the proto for the XmNdecodeGIFProc resource */
  930. typedef int (*XmImageGifProc)(XmHTMLGIFStream*);
  931.  
  932. /*****
  933. * Progressive Loading function prototypes.
  934. * XmHTMLGetDataProc: proto for function installed on the
  935. *                    XmNprogressiveReadProc resource;
  936. * XmHTMLEndDataProc: proto for function installed on the
  937. *                    XmNprogressiveEndProc resource;
  938. *****/
  939. typedef int  (*XmHTMLGetDataProc)(XmHTMLPLCStream*, TPointer);
  940. typedef void (*XmHTMLEndDataProc)(XmHTMLPLCStream*, TPointer, int, Boolean);
  941.  
  942. /*****
  943. * possible values for the third argument on the EndDataProc
  944. *****/
  945. enum{
  946.     /* XmHTML_NONE = 0 */    /* PLCObject referenced by all objects */
  947.     XmPLC_IMAGE,        /* PLCObject for an image */
  948.     XmPLC_DOCUMENT,        /* PLCObject for a document */
  949.     XmPLC_FINISHED        /* indicates all plc's have been processed */
  950. };
  951.  
  952. /*****
  953. * XmImage configuration
  954. *****/
  955. typedef struct{
  956.     unsigned long flags;        /* XmImage configuration flags, see above    */
  957.     int ncolors;                /* desired number of colors                    */
  958.     int which_frames;            /* animation frames selection flag            */
  959.     int bg_color;                /* background pixel on transparent images    */
  960.     String z_cmd;                /* gif uncompress command                    */
  961.     XmImageGifProc gif_proc;    /* external gif decoder                        */
  962.     float gamma;                /* gamma correction. JPEG and PNG only        */
  963. }XmImageConfig;
  964.  
  965. /******************************************************************************
  966. * Callback structures
  967. * Unless explicitly mentioned, *none* of these structures (or any of its
  968. * members) may be freed.
  969. ******************************************************************************/
  970.  
  971. /*****
  972. * XmNactivateCallback and XmNanchorTrackCallback callback structure.
  973. *****/
  974. typedef struct _XmHTMLAnchorCallbackStruct{
  975.     int reason;                /* the reason the callback was called        */
  976.     TEvent *event;            /* event structure that triggered callback    */
  977.     URLType url_type;        /* type of url referenced                    */
  978.     Cardinal line;            /* line number of the selected anchor        */
  979.     String href;            /* pointer to the anchor value                */
  980.     String target;            /* pointer to target value                    */
  981.     String rel;                /* pointer to rel value                        */
  982.     String rev;                /* pointer to rev value                        */
  983.     String title;            /* pointer to title value                    */
  984.     Boolean is_frame;        /* true when inside a frame                    */
  985.     Boolean doit;            /* local anchor vetoing flag                */
  986.     Boolean visited;        /* local anchor visited flag                */
  987. }XmHTMLAnchorCallbackStruct;
  988.  
  989. typedef Boolean (*XmHTMLAnchorProc)(TWidget, String, TPointer);
  990.  
  991. /*****
  992. * XmNeventCallback callback structure.
  993. *****/
  994. typedef struct{
  995.     int            reason;            /* the reason the event was called        */
  996.     TEvent        *event;            /* event triggering this action            */
  997.     int            type;            /* HTML4.0 event type, see above        */
  998.     TPointer    data;            /* HTML4.0 event callback data            */
  999. }XmHTMLEventCallbackStruct;
  1000.  
  1001. /*****
  1002. * XmNdocumentCallback callback structure.
  1003. *****/
  1004. typedef struct
  1005. {
  1006.     int reason;                    /* the reason the callback was called        */
  1007.     TEvent *event;                /* always NULL for XmNdocumentCallback        */
  1008.     Boolean html32;                /* True if document was HTML 3.2 conforming    */
  1009.     Boolean verified;            /* True if document has been verified        */
  1010.     Boolean balanced;            /* True if parser tree is balanced            */
  1011.     Boolean terminated;            /* True if parser terminated prematurely    */
  1012.     int pass_level;                /* current parser level count. Starts at 1    */
  1013.     Boolean redo;                /* perform another pass?                    */
  1014. }XmHTMLDocumentCallbackStruct, *XmHTMLDocumentPtr;
  1015.  
  1016. /*****
  1017. * XmNformCallback callback structure.
  1018. *****/
  1019. /*****
  1020. * Form Component data
  1021. *****/
  1022. typedef struct
  1023. {
  1024.     componentType type;            /* Form component type    */
  1025.     String name;                /* component name        */
  1026.     String value;                /* component value        */
  1027. }XmHTMLFormDataRec, *XmHTMLFormDataPtr;
  1028.  
  1029. /*****
  1030. * Actual XmNformCallback callback structure.
  1031. *****/
  1032. typedef struct
  1033. {
  1034.     int reason;                /* the reason the callback was called        */
  1035.     TEvent *event;            /* event structure that triggered callback    */
  1036.     String action;            /* URL or cgi-bin destination                */
  1037.     String enctype;            /* form encoding                            */
  1038.     int method;                /* Form Method, GET, POST or PIPE            */
  1039.     int ncomponents;        /* no of components in this form            */
  1040.     XmHTMLFormDataPtr components;
  1041. }XmHTMLFormCallbackStruct, *XmHTMLFormPtr;
  1042.  
  1043. /*****
  1044. * XmNframeCallback callback structure.
  1045. * This callback is activated when one of the following events occurs:
  1046. * 1. XmHTML wants to create a frame, reason = XmCR_HTML_FRAMECREATE
  1047. *    can be veto'd by setting doit to False and supplying a HTML widget
  1048. *    id yourself;
  1049. * 2. XmHTML wants to destroy a frame, reason = XmCR_HTML_FRAMEDESTROY
  1050. *    can be veto'd by setting doit to False (widget reuse).
  1051. * 3. XmHTML has finished creating a frame, reason = XmCR_HTML_FRAME.
  1052. *    This is the time to attach callbacks and set additional resources on the
  1053. *    newly created XmHTMLWidget.
  1054. *****/
  1055. typedef struct
  1056. {
  1057.     int reason;            /* the reason the callback was called        */
  1058.     TEvent *event;        /* event structure that triggered callback    */
  1059.     String src;            /* requested document                        */
  1060.     String name;        /* frame name                                */
  1061.     TWidget html;        /* XmHTML widget id                            */
  1062.     Boolean doit;        /* destroy/create vetoing flag                */
  1063. }XmHTMLFrameCallbackStruct, *XmHTMLFramePtr;
  1064.  
  1065. /*****
  1066. * XmNimagemapCallback callback structure.
  1067. * callback reasons can be one of the following: 
  1068. * XmCR_HTML_IMAGEMAP_ACTIVATE
  1069. *    user clicked on an image. Valid fields are x, y and image_name. x and y
  1070. *    are relative to the upper-left corner of the image. Only invoked when
  1071. *    an image has it's ismap attribute set and no usemap is present for this
  1072. *    image.
  1073. * XmCR_HTML_IMAGEMAP
  1074. *    an image requires an external imagemap. The only valid field is map_name
  1075. *    which contains the location of the imagemap to fetch. If the contents
  1076. *    of this imagemap is set in the map_contents field, it will be loaded
  1077. *    by the widget. Alternatively, one could also use the XmHTMLAddImagemap
  1078. *    convenience routine to set an imagemap into the widget.
  1079. *****/
  1080. typedef struct
  1081. {
  1082.     int reason;            /* the reason the callback was called                */
  1083.     TEvent *event;        /* event structure that triggered callback            */
  1084.     int x,y;            /* position relative to the upper-left image corner    */
  1085.     String image_name;    /* name of referenced image, value of src attribute    */
  1086.     String map_name;    /* name of imagemap to fetch                        */
  1087.     String map_contents;/* contents of fetched imagemap                        */
  1088.     XmImageInfo *image;    /* image data                                        */
  1089. }XmHTMLImagemapCallbackStruct, *XmHTMLImagemapPtr;
  1090.  
  1091. /*****
  1092. * XmNlinkCallback callback structure.
  1093. *****/
  1094. typedef struct{
  1095.     int reason;                    /* the reason the callback was called        */
  1096.     TEvent *event;                /* event structure that triggered callback    */
  1097.     int num_link;                /* number of LINK info to process            */
  1098.     XmHTMLLinkDataPtr link;        /* array of LINK info to process            */
  1099. }XmHTMLLinkCallbackStruct, *XmHTMLLinkPtr;
  1100.  
  1101. /* Don't add anything after this endif! */
  1102. #endif /* _HTML_h_ */
  1103.